<template>
	<view
		style="background-color:#F5F5F5;  width: 100%;
	display: flex;
	
	align-items: center;
	flex-direction: column;
	"
	>
	<view class="" v-if="xinxi==true" style="background-color: #FFFFFF;width: 100%;" v-show="order==true">
		<view style="display: flex;align-items: center;flex-direction: column;" >
			<image src="../../static/img/pic_denglu.png" mode="" style="width: 136px;height:136px;margin-top: 20px;"></image>
			<text style="color: #000000;font-size: 18px;font-weight: 500;margin-top: 15px;">暂未登录</text>
			<text style="color: #777777;font-size: 15px;margin-top: 12px;">你还未登录，即将为你跳转登录页面~</text>
		</view>
	</view>
	<view class="" v-if="xinxi==false">
		
		<view style="width:355px;height: 48px;background:rgba(255,255,255,1);border-radius:8px;font-size: 16px;display: flex;align-items: center;justify-content: space-around;margin-top: 10px;position: fixed;left: 10px;z-index: 1;">
			<view style="height: 100%;display: flex;align-items: center;flex-direction: column;" :class="plan == true ? 'plan' : 'plans'" @click="planordered">
				<text style="margin-bottom: 9px;margin-top: 14px;">定向单</text>
				<text style="background-color:#000000;border-radius:8px;height: 4px;width:30px;" v-show="plan == true"></text>
			</view>
			<view style="height: 100%;display: flex;align-items: center;flex-direction: column;" :class="plan == false ? 'plan' : 'plans'" @click="planorders">
				<text style="margin-bottom: 9px;margin-top: 14px;">计划单</text>
				<text style="background-color:#000000;border-radius:8px;height: 4px;width:30px;" v-show="plan == false"></text>
			</view>
		</view>
		<!-- 筛选 -->
		<view style="width: 355px;height: 40px;background-color: #FFFFFF;position: fixed;margin-top: 69px;left: 10px;z-index: 1;display: flex;">
			<input type="text"  class="inputed" v-model="ordernumber" placeholder="请输入订单编号" style="background-image: url(../../static/img/order/icon_sousuo.png);background-size: 14px 14px;background-repeat: no-repeat;background-position: 14px 14px; padding-left: 34px;"/>
			<view class="searbut" @click="search">查询</view>
		</view>
		<view class="" style="width: 355px;height: 45px;position: fixed;margin-top: 114px;left: 10px;z-index: 1;display: flex;">
			<view class="addred" @click="addreds" >
				<view style="overflow:hidden; text-overflow:ellipsis;  white-space:nowrap;width: 60px;height: 20px;margin-left: 10px;">
					<text v-if="shipAddred==''">装货地</text>
					<text v-if="shipAddred!=''">{{shipAddred}}</text>
				</view>
				<image src="../../static/img/icon_xiala_xiaohui.png" mode="" style="width: 8px;height: 5px;"></image>
				<view style="width:1px;height:11px;background:rgba(216,216,216,1);border-radius:1px;margin-left: 8px;"></view>
			</view>
			<view class="addred" @click="placeOfReceipt">
				<view style="overflow:hidden; text-overflow:ellipsis;  white-space:nowrap;width: 60px;height: 20px;">
					<text v-if="placeOfReceipted==''">卸货地</text>
					<text v-if="placeOfReceipted!=''">{{placeOfReceipted}}</text>
				</view>
				<image src="../../static/img/icon_xiala_xiaohui.png" mode="" style="width: 8px;height: 5px;"></image>
				<view style="width:1px;height:11px;background:rgba(216,216,216,1);border-radius:1px;margin-left: 8px;"></view>
			</view>
			<view class="addred" @click="showPicker">
				<view style="overflow:hidden; text-overflow:ellipsis;  white-space:nowrap;width: 60px;height: 20px;">
					{{chooseDate}}
				</view>
				<image src="../../static/img/icon_xiala_xiaohui.png" mode="" style="width: 8px;height: 5px;"></image>
				<view style="width:1px;height:11px;background:rgba(216,216,216,1);border-radius:1px;margin-left: 8px;"></view>
			</view>
			<view class="addred" @click="states">
				<view style="overflow:hidden; text-overflow:ellipsis;  white-space:nowrap;width: 60px;height: 20px;">
					{{state}}
				</view>
				<image src="../../static/img/icon_xiala_xiaohui.png" mode="" style="width: 8px;height: 5px;"></image>
			</view>
		</view>
		<view style="margin-top:164px ;" :class="leng > 4 ? 'contoned' : 'contonts'" v-if="plan == true">
			<view style="margin-top:10px ;" v-for="(v, i) in list" :key="i" @click="orderdetail(i)" class="contont" >
				<view class="ordercode">
					<text style="font-size: 15px; font-weight:500;margin-left: 15px;">订单号：{{ v.orderCode }}</text>
					<text style="font-size: 15px; font-weight:500;margin-right: 15px;color: #042A58;">
						<text v-if="v.driverstatus == 0">无状态</text>
						<text v-if="v.driverstatus == 1">未接单</text>
						<text v-if="v.driverstatus == 2">已接单</text>
						<text v-if="v.driverstatus == 3">已发车</text>
						<text v-if="v.driverstatus == 4">已完成</text>
						<text v-if="v.driverstatus == 5">已回单</text>
						<text v-if="v.driverstatus == 6">拒单</text>
						<text v-if="v.driverstatus == 7">已取消</text>
					</text>
				</view>
				<view class="address">
					<view class="addresscar">
						<view class="" style="width: 34px; height: 14px;">
							<image src="../../static/img/icon_dingwei.png" mode="" style="width: 14px; height: 14px; margin-left: 15px;"></image>
						</view>
						<view
							style=" margin-left: 5px;
				overflow:hidden;
					text-overflow:ellipsis;
					white-space:nowrap
				"
						>
							<text>装货地：{{ v.sendAddress }}</text>
						</view>
					</view>
					<view class="addresscar">
						<view class="" style="width: 34px; height: 14px;">
							<image src="../../static/img/icon_zdz@2x.png" mode="" style="width: 18px; height: 9px; margin-left: 13px"></image>
						</view>
						<view
							style=" margin-left: 5px;
				 overflow:hidden;
				 	text-overflow:ellipsis;
				 	white-space:nowrap
				 "
						>
							<text>卸货地：{{ v.receiveAddress }}</text>
						</view>
					</view>
				</view>

				<view class="number">
					<view class="numbers" style="height: 24px; width: 90px; margin-left: 15px;color: #042A58;">{{ v.unitPrice }}元/{{ add[i].weightName }}</view>
					<view class="numbers" style="height: 24px; width: 53px;color: #042A58;">
						<!-- {{this.add[i].weight}}{{add[i].weightName}}	 -->
						<text>{{ add[i].piece }}{{ add[i].weightName }}</text>
					</view>
					<view class="numbers" style="height: 24px; padding-left:8px ;padding-right: 8px; color: #042A58;">承运人:{{ v.contactname }}</view>
				</view>
				<view class="money" style="height: 38px;border-top: 1px solid #F5F5F5;display: flex;align-items: center;">
					<view style="font-size:12px;font-weight:400;color:rgba(74,74,74,1); margin-left: 15px;">
						接单情况:
						<text v-if="v.driverstatus == 0">无状态</text>
						<text v-if="v.driverstatus == 1">未接单</text>
						<text v-if="v.driverstatus == 2">已接单</text>
						<text v-if="v.driverstatus == 3">已发车</text>
						<text v-if="v.driverstatus == 4">已完成</text>
						<text v-if="v.driverstatus == 5">已回单</text>
						<text v-if="v.driverstatus == 6">拒单</text>
						<text v-if="v.driverstatus == 7">已取消</text>
					</view>
					<text style="font-size:12px;font-weight:500; color:rgba(254,7,0,1); margin-right: 15px;">总运费:{{ ((v.typearrive+v.typebefore+v.typemonthly+v.typereceipt) / (94 / 100)) | addZero }}元</text>
				</view>
			</view>
		</view>
		<view style="margin-top:164px ;">
		<view v-if="plan==false" class="conton" v-for="(v,i) in pled" :key="i" @click="Order_dismantling(i)">
			<view class="ordercode">
				<text style="font-size: 15px; font-weight:500;margin-left: 15px;">计划单号：{{ v.orderCode }}</text>
				<view style="font-size: 15px; font-weight:500;margin-right: 15px;">
					<text v-if="v.isDetach == 1" style="color: #002CFF;">待接单</text>
					<text v-if="v.isDetach == 2" style="color: #00A56C;">拆单中</text>
					<text v-if="v.isDetach == 3" style="color: #FF5F2E;">已完成</text>
				</view>
			</view>
			<view class="address" style="position: relative;">
				<view class="addresscar">
					<view class="" style="width: 34px; height: 14px;">
						<image src="../../static/img/icon_dingwei.png" mode="" style="width: 14px; height: 14px; margin-left: 15px;"></image>
					</view>
					<view style=" margin-left: 5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">
						<text>装货地：{{ v.sendAddress }}</text>
					</view>
				</view>
				<view class="addresscar">
					<view class="" style="width: 34px; height: 14px;">
						<image src="../../static/img/icon_zdz@2x.png" mode="" style="width: 18px; height: 9px; margin-left: 13px"></image>
					</view>
					<view style=" margin-left: 5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">
						<text>卸货地：{{ v.receiveAddress }}</text>
					</view>
				</view>
				<image src="../../static/img/icon_youjian_da.png" mode="" style="width: 7px;height: 14px;position: absolute;right: 20px;top: 50%;"></image>
			</view>

			<view class="number">
				<view class="numbers" style="height: 24px; width: 90px; margin-left: 15px;color: #042A58;">{{ v.unitPrice }}元/{{ planadd[i].weightName }}</view>
				<view class="numbers" style="height: 24px; width: 40px;color: #042A58;">
					<text>{{ planadd[i].piece }}{{ planadd[i].weightName }}</text>
				</view>
			</view>
			<view style="width:345px;height:50px;background:rgba(250,250,250,1);border-radius:7px;font-size: 13px;margin-top: 5px;margin-left: 5px;">
				<view style="width: 100%; display: flex;align-items: center;justify-content: space-between;">
					<text style="color: #042A58;margin-left: 30rpx;margin-top: 10px;">已运{{ v.wayBillNum * planadd[i].piece }}{{ planadd[i].weightName }}</text>
					<text style="color: #777777;margin-right: 10px;margin-top: 10px;">计划总量{{ planadd[i].piece * v.orderNum }}{{ planadd[i].weightName }}</text>
				</view>
				<view style="width:325px;height:8px;background:rgba(215,219,229,1);border-radius:7px;margin-top: 8px;margin-left: 10px;">
					<view :style="'width:' + ((v.wayBillNum * planadd[i].piece) / (planadd[i].piece * v.orderNum)) * 100 + '%'" style="text-align: right;position: relative;" class="plac">
						<image src="../../static/img/pic_jindutiao.png" mode="" style="width: 14px;height: 14px;right: -4px;position: absolute;top: -3px;"></image>
					</view>
				</view>
			</view>
			<view class="money" style="justify-content: flex-end;">
				<view style="font-size:12px;font-weight:500; color:rgba(254,7,0,1); margin-right: 15px;margin-top: 6px;">
					总运费：{{ Math.ceil(plannumber[i] * v.orderNum.toFixed(3) * 100) / 100 }}
				</view>
			</view>
		</view>
		</view>
		<!-- 筛选装货 -->
		<view class="mask" v-if="pricks">
			<view style="width: 100%;border-radius:8px 8px 0px 0px;background-color: #FFFFFF;">
				<view style="height: 56px;display: flex;align-items: center;justify-content: space-between;font-size: 16px;">
					<text style="margin-left: 15px;color: #9B9B9B;" @click="pricks=false">取消</text>
					<text>请选择装货地</text>
					<text style="margin-right: 15px;color: #042A58;" @click="Determine">确定</text>
				</view>
				<view style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px;" v-if="shipAddred!=''">
					<view class="addresing">
						已选地址
					</view>
					<view style="width: 334px;margin-right: 15px;font-size: 14px;color: #000000;">
						{{shipAddred}}
					</view>
				</view>
			</view>
			<picker-view indicator-style="height: 50px;" @change="bindChanged" >
				<picker-view-column >
					<view class="masked">
						全部
					</view>
					<view v-for="(v,i) in shipAddress" :key="i" class="masked">
						{{v.address}}
					</view>
				</picker-view-column>
			</picker-view>
		</view>
		<!-- 筛选卸货 -->
		<view class="mask" v-if="prick">
			<view style="width: 100%;border-radius:8px 8px 0px 0px;background-color: #FFFFFF;">
				<view style="height: 56px;display: flex;align-items: center;justify-content: space-between;font-size: 16px;">
					<text style="margin-left: 15px;color: #9B9B9B;" @click="prick=false">取消</text>
					<text>请选择装货地</text>
					<text style="margin-right: 15px;color: #042A58;" @click="Determines">确定</text>
				</view>
				<view style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px;" v-if="placeOfReceipting!=''">
					<view class="addresing">
						已选地址
					</view>
					<view style="width: 334px;margin-right: 15px;font-size: 14px;color: #000000;">
						{{placeOfReceipted}}
					</view>
				</view>
			</view>
			<picker-view indicator-style="height: 50px;" @change="bindChanges" >
				<picker-view-column >
					<view class="masked">
						全部
					</view>
					<view v-for="(v,i) in placeOfReceipter" :key="i" class="masked">
						{{v.address}}
					</view>
				</picker-view-column>
			</picker-view>
		</view>
		<!-- 状态 -->
		<view class="mask" v-if="pricked">
			<view style="width: 100%;border-radius:8px 8px 0px 0px;background-color: #FFFFFF;">
				<view style="height: 56px;display: flex;align-items: center;justify-content: space-between;font-size: 16px;">
					<text style="margin-left: 15px;color: #9B9B9B;" @click="Detemine">取消</text>
					<text>请选择装货地</text>
					<text style="margin-right: 15px;color: #042A58;" @click="Determined">确定</text>
				</view>
				<view style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px;" v-if="state!='卸货地'">
					<view class="addresing">
						已选状态
					</view>
					<view style="width: 334px;margin-right: 15px;font-size: 14px;color: #000000;">
						{{state}}
					</view>
				</view>
			</view>
			<picker-view indicator-style="height: 50px;" @change="bindChanging" >
				<picker-view-column >
					<view v-for="(v,i) in stated" :key="i" class="masked">
						{{v}}
					</view>
				</picker-view-column>
			</picker-view>
		</view>
		<!-- 时间 -->
		<rangeDatePick
			:show="isShow"
			@showchange="showchange"
			@showchang="showchang"
			:start="Data"
			end="2200-12-31"
			@change="bindChang"
			themeColor="#4C83D6"
			fields="day"
			v-if="timeadd"
		></rangeDatePick>
		<view class="loading">{{ loadingTxt }}</view>
		</view>
	</view>
</template>
<script>
import uel from '../../cookie.js';
import {ajaxs} from '../../apis.js';
import {HZajaxs} from "../../HZapis.js"
import rangeDatePick from '@/components/range-dtpicker/range-dtpicker.vue';
var page = 1;
var timer = null;
var that = this;
export default {
	components:{
		rangeDatePick
	},
	data() {
		return {
			order:false,
			xinxi:true,
			loadingTxt: '加载更多',
			list: [],
			add: [],
			num: [],
			account: '',
			Password: '',
			plan: true,
			planer: false,
			pled: [],
			planadd: [],
			plannumber: '',
			orderlist:[],
			leng:"",
			shipAddred:"",
			shipAddress:[],
			pricks:false,
			index:0,
			prick:false,
			placeOfReceipter:[],
			placeOfReceipted:"",
			nowDate:currentDate,//获取当前时间
			isShow:false,
			value:[],
			chooseDate:"选择时间段",
			state:"全部",
			stated:[],
			staterd:["0"],
			pricked:false,
			ordernumber:"",
			timers:"",
			timered:"",
			shipAddring:"",
			placeOfReceipting:"",
			timeadd:false,
			Data:""
		};
		const currentDate = this.getDate({
		   format: true
		})
	},

	filters: {
		addZero(data) {
			return Math.ceil(data.toFixed(3) * 100) / 100;
		}
	},
	// 分享
	onShareAppMessage: function(options) {
		var that = this; // 设置菜单中的转发按钮触发转发事件时的转发内容
		var shareObj = {
			title: '优货达货主', // 默认是小程序的名称(可以写slogan等)
			path: '', // 默认是当前页面，必须是以‘/’开头的完整路径
			imageUrl: '../../static/img/fenxiang.png' //自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
		}; // 返回shareObj
		return shareObj;
	},
	onLoad(option) {
		if (option.id == 1) {
			this.plan = false;
		} else {
			this.plan = true;
		}
		var currentDate = new Date()
			var y = currentDate.getFullYear(); //年
			var m = currentDate.getMonth() + 1; //月
			if(m<10){
				var mother='0'+m
			}else{
				var mother=m
			}
			var d = currentDate.getDate(); //日
			if(d<10){
				var day='0'+d
			}else{
				var day=d
			}
		this.Data=y+"-"+mother+"-"+day
		if(this.Data==this.Data){
			this.timeadd=true
		}
		// 登录
	},
	onShow: function() {
		var that = this;
		uni.getStorage({
			key: 'name',
			success: function(res) {
				
				that.orderlist= res;
				HZajaxs({
					url: '/user/loginsubmit',
					data: {
						loginname: res.data[1],
						password: res.data[2]
					},
					success(res) {
						if (res.data.status == 'OK') {
							uni.setStorageSync('sessionid', res.header['Set-Cookie']);
							var name = [res.data.status, that.orderlist.data[1], that.orderlist.data[2]];
							uni.setStorage({
								key: 'name',
								data: name
							});
						} else {
							that.order=true
							uni.showToast({
							    title: '正在前往登录请稍后',
								icon:"none"
							})
							
							setTimeout(function(){
								uni.reLaunch({
									url:"../index/index"
								})
							},500)
						}
					}
				});
			},
			fail() {
				that.order=true
				uni.showToast({
				    title: '正在前往登录请稍后',
					icon:"none"
				})
				setTimeout(function(){
					uni.reLaunch({
						url:"../index/index"
					})
				},1000)
			}
		});
		uni.showLoading({
			title: '加载中请稍等'
		});
			this.getNews();
			this.plans();
	},
	onPullDownRefresh() {
		this.getNews();
		this.plans();
	},
	onReachBottom() {
		var that = this;
		this.getMoreNews();
		this.planed();
	},
	methods: {
		// 筛选
		// 查询
		search(){
			if(this.plan==false){
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/order/total/order/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					  isDetach:that.staterd,
					 },
					success(res) {
						if(res.data.status=="OK"){
							that.pled = res.data.message.list;
							that.pricked=false
						}
						let css = [];
						res.data.message.list.forEach(function(v, i) {
							css.push(Math.ceil((v.totalPrice / (94 / 100).toFixed(3)) * 100) / 100);
							that.plannumber = css;
						});
						res.data.message.list.forEach(function(v, i) {
							that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
						});
					}
				});
			}else{
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/carrier/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 driverstatus:that.staterd,
					 },
					success(res) {
							that.list = res.data.list;
							that.leng=that.list.length
							that.pricked=false
						res.data.list.forEach(function(v, i) {
							that.add = that.add.concat(JSON.parse(v.goodsjson));
						});
					},
				});
			}
		},
		// 状态
		states(){
			if(this.plan==false){
				this.stated=['全部','未接单','已拆单','完成']
				this.staterd=[0,1,2,3]
				this.pricked=true
				this.index=0
			}else{
				this.stated=['全部','未接单','已接单','已发车','已完成','已回单','拒单','后台取消运单','已结算']
				this.staterd=[0,1,2,3,4,5,6,7,8]
				this.pricked=true
				this.index=0
			}
		},
		bindChanging(event){
			this.index=event.detail.value[0]
		}, 
		Detemine(){
			this.pricked=false
			this.staterd=["0"]
		},
		Determined(){
			this.state=this.stated[this.index]
			this.staterd=this.staterd[this.index]
			if(this.plan==false){
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/order/total/order/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 isDetach:that.staterd,
					 },
					success(res) {
						if(res.data.status=="OK"){
							that.pricked=false
							that.pled = res.data.message.list;
						}
						let css = [];
						res.data.message.list.forEach(function(v, i) {
							css.push(Math.ceil((v.totalPrice / (94 / 100).toFixed(3)) * 100) / 100);
							that.plannumber = css;
						});
						res.data.message.list.forEach(function(v, i) {
							that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
						});
					}
				});
			}else{
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/carrier/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 driverstatus:that.staterd,
					 },
					success(res) {
							that.list = res.data.list;
							that.leng=that.list.length
						res.data.list.forEach(function(v, i) {
							that.pricked=false
							that.add = that.add.concat(JSON.parse(v.goodsjson));
						});
					},
				});
			}
		},
		// 时间
		showPicker(e){
			this.isShow=true
		},
		showchange(){
			this.chooseDate="请选择起止时间",
			this.timers="",
			this.timered="",
			this.isShow=!this.isShow;
			if(this.plan==false){
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/order/total/order/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 isDetach:that.staterd,
					 },
					success(res) {
						if(res.data.status=="OK"){
							that.pled = res.data.message.list;
							that.pricked=false
						}
						let css = [];
						res.data.message.list.forEach(function(v, i) {
							css.push(Math.ceil((v.totalPrice / (94 / 100).toFixed(3)) * 100) / 100);
							that.plannumber = css;
						});
						res.data.message.list.forEach(function(v, i) {
							that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
						});
					}
				});
			}else{
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/carrier/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 driverstatus:that.staterd,
					 },
					success(res) {
							that.list = res.data.list;
							that.leng=that.list.length
							that.pricked=false
						res.data.list.forEach(function(v, i) {
							that.add = that.add.concat(JSON.parse(v.goodsjson));
						});
					},
				});
			}
		},
		showchang(){
			this.isShow=!this.isShow;
		},
		bindChang(data){
			this.chooseDate=data[0]+"至"+data[1]
			this.timers=data[0]
			this.timered=data[1]
			if(this.plan==false){
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/order/total/order/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 isDetach:that.staterd,
					 },
					success(res) {
						if(res.data.status=="OK"){
							that.pled = res.data.message.list;
							that.isShow=false
						}
						let css = [];
						res.data.message.list.forEach(function(v, i) {
							css.push(Math.ceil((v.totalPrice / (94 / 100).toFixed(3)) * 100) / 100);
							that.plannumber = css;
						});
						res.data.message.list.forEach(function(v, i) {
							that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
						});
					}
				});
			}else{
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/carrier/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 driverstatus:that.staterd,
					 },
					success(res) {
							that.list = res.data.list;
							that.leng=that.list.length
							that.isShow=false
						res.data.list.forEach(function(v, i) {
							that.add = that.add.concat(JSON.parse(v.goodsjson));
						});
					},
				});
			}
		},
		// chooseDate
		getDate(type) {
			const date = new Date();
			let year = date.getFullYear();
			let month = date.getMonth() + 1;
			let day = date.getDate();
			month = month > 9 ? month : '0' + month;
			day = day > 9 ? day : '0' + day;
			return `${year}-${month}-${day}`;
		},
		// 装车
		addreds(){
			var that=this
				ajaxs({
					url: '/v1/address/list',
					method: 'post',
					data: { addresstype: 1,
					offset: 1,
					limit: 20,
					},
				
					success(res) {
						that.shipAddress=res.data.list
						//     请求成功的处理
						// res.data.list.forEach(function(item, index) { 
						// 	that.shipAddress=item.address;
						// });
						that.index=0
						that.pricks=true
					}
				})
		},
		bindChanged(event){
			this.index=event.detail.value[0]
		}, 
		Determine(){
			if(this.index==0){
				this.shipAddred=""
				this.shipAddring=""
			}else{
				this.shipAddred=this.shipAddress[this.index-1].province+this.shipAddress[this.index-1].city+this.shipAddress[this.index-1].county+this.shipAddress[this.index-1].address
				this.shipAddring=this.shipAddress[this.index-1].address
			}
			if(this.plan==false){
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/order/total/order/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 isDetach:that.staterd,
					 },
					success(res) {
						if(res.data.status=="OK"){
							that.pled = res.data.message.list;
							that.pricks=false
						}
						let css = [];
						res.data.message.list.forEach(function(v, i) {
							css.push(Math.ceil((v.totalPrice / (94 / 100).toFixed(3)) * 100) / 100);
							that.plannumber = css;
						});
						res.data.message.list.forEach(function(v, i) {
							that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
						});
					}
				});
			}else{
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/carrier/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 driverstatus:that.staterd,
					 },
					success(res) {
							that.list = res.data.list;
							that.leng=that.list.length
							that.pricks=false
						res.data.list.forEach(function(v, i) {
							that.add = that.add.concat(JSON.parse(v.goodsjson));
						});
					},
				});
			}
		},
		// 卸车
		placeOfReceipt(){
			var that=this
			ajaxs({
				url: '/v1/address/list',
				method: 'post',
				data: { addresstype: 2,
				  offset: 1, 
				  limit: 20
				 },
						
				success(res) {
					//     请求成功的处理
					that.index=0
						that.placeOfReceipter=res.data.list
						that.prick=true
				}
			});
		},
		bindChanges(event){
			this.index=event.detail.value[0]
		}, 
		Determines(){
			if(this.index==0){
				this.placeOfReceipted=""
				this.placeOfReceipting=""
			}else{
				this.placeOfReceipted=this.placeOfReceipter[this.index-1].province+this.placeOfReceipter[this.index-1].city+this.placeOfReceipter[this.index-1].county+this.placeOfReceipter[this.index-1].address
				this.placeOfReceipting=this.placeOfReceipter[this.index-1].address
			}
			if(this.plan==false){
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/order/total/order/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 isDetach:that.staterd,
					 },
					success(res) {
						if(res.data.status=="OK"){
							that.pled = res.data.message.list;
							that.prick=false
						}
						let css = [];
						res.data.message.list.forEach(function(v, i) {
							css.push(Math.ceil((v.totalPrice / (94 / 100).toFixed(3)) * 100) / 100);
							that.plannumber = css;
						});
						res.data.message.list.forEach(function(v, i) {
							that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
						});
					}
				});
			}else{
				page = 1;
				var that = this;
				ajaxs({
					url: '/v1/carrier/list',
					method: 'post',
					data: { offset: page, limit: 10,
					 orderCode:that.ordernumber,
					 shipAddress:that.shipAddring,
					 placeOfReceipt:that.placeOfReceipting,
					 createTimeStart:that.timers,
					 createTimeEnd:that.timered,
					 driverstatus:that.staterd,
					 },
					success(res) {
							that.list = res.data.list;
							that.leng=that.list.length
							that.prick=false
						res.data.list.forEach(function(v, i) {
							that.add = that.add.concat(JSON.parse(v.goodsjson));
						});
					},
				});
			}
		},
		// 楼层
		planorders(){
			this.ordernumber="",
			this.shipAddring="",
			this.placeOfReceipting="",
			this.timers="",
			this.timered="",
			this.staterd=["0"],
			this.placeOfReceipted="",
			this.shipAddred="",
			this.index=0,
			this.chooseDate="选择时间段",
			this.state="全部",
			this.plan =false
			    if (wx.pageScrollTo) {
			      wx.pageScrollTo({
			        scrollTop: 0
			      })
			    } else {
			    }
		},
		Order_dismantling(i) {
			uni.navigateTo({
				url: './planorder?id=' + this.pled[i].id + '&index=' + i
			});
		},
		planordered(){
			this.ordernumber="",
			this.shipAddring="",
			this.placeOfReceipting="",
			this.placeOfReceipted="",
			this.shipAddred="",
			this.timers="",
			this.timered="",
			this.staterd=["0"],
			this.index=0,
			this.chooseDate="选择时间段",
			this.state="全部",
			this.plan =true
			    if (wx.pageScrollTo) {
			      wx.pageScrollTo({
			        scrollTop: 0
			      })
			    } else {
			    }
		},
		// 计划单
		planed() {
			var that = this;
			uni.showNavigationBarLoading();
			ajaxs({
							url: '/v1/order/total/order/list',
							method: 'post',
							data: { offset: page, limit: 1,
							 orderCode:that.ordernumber,
							 shipAddress:that.shipAddring,
							 placeOfReceipt:that.placeOfReceipting,
							 createTimeStart:that.timers,
							 createTimeEnd:that.timered,
							 isDetach:that.staterd,
							 },
				success(res) {
					if (that.pled.length == res.data.message.total) {
						setTimeout(function() {
							that.loadingTxt = '已经全部加载';
						}, 100);
						uni.hideNavigationBarLoading();
						return false;
					}
					uni.hideNavigationBarLoading();
					var list = res.data.message.list;
					that.pled = that.pled.concat(list);
					res.data.message.list.forEach(function(v, i) {
						that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
					});
					uni.stopPullDownRefresh();
					page++;
					that.loadingTxt = '加载更多';
				}
			});
		},
		plans() {
			page = 1;
			var that = this;
			uni.showNavigationBarLoading();
			setTimeout(function(){
			 ajaxs({
				url: '/v1/order/total/order/list',
				method: 'post',
				data: { offset: page, limit: 10,
				 orderCode:that.ordernumber,
				 shipAddress:that.shipAddring,
				 placeOfReceipt:that.placeOfReceipting,
				 createTimeStart:that.timers,
				 createTimeEnd:that.timered,
				 isDetach:that.staterd,
				 },
				success(res) {
					uni.hideLoading();
					if(res.data.status=="OK"){
						that.pled = res.data.message.list;
					}
					// var i = 10;
					// var s = i.toString();
					// console.log(s)
					// var i=[]
					let css = [];
					res.data.message.list.forEach(function(v, i) {
						css.push(Math.ceil((v.totalPrice / (94 / 100).toFixed(3)) * 100) / 100);
						that.plannumber = css;
					});
					res.data.message.list.forEach(function(v, i) {
						that.planadd = that.planadd.concat(JSON.parse(v.goodsjson));
					});
					uni.stopPullDownRefresh();
					uni.hideNavigationBarLoading();
					page++;
				}
			});
			},1000)
		},
		// 列表
		getMoreNews() {
			this.loadingTxt = '加载中';
			var that = this;
			uni.showNavigationBarLoading();
			 ajaxs({
				url: '/v1/carrier/list',
				method: 'post',
				data: { offset: page, limit: 10,
				 orderCode:that.ordernumber,
				 shipAddress:that.shipAddring,
				 placeOfReceipt:that.placeOfReceipting,
				 createTimeStart:that.timers,
				 createTimeEnd:that.timered,
				 isDetach:that.staterd,
				 },
				success(res) {
					if (that.list.length == res.data.total) {
						setTimeout(function() {
							that.loadingTxt = '已经全部加载';
						}, 100);
						uni.hideNavigationBarLoading();
						return false;
					}
					uni.hideNavigationBarLoading();
					// console.log(res.data.list.id)
					// that.list=res.data.list
					var list = res.data.list;
					that.list = that.list.concat(list);
					res.data.list.forEach(function(v, i) {
						that.add = that.add.concat(JSON.parse(v.goodsjson));
					});
					uni.stopPullDownRefresh();
					page++;
					that.loadingTxt = '加载更多';
					//请求成功的处理
				}
			});
		},
		getNews() {
			var that = this;
			page = 1;

			uni.showNavigationBarLoading();
			setTimeout(function(){
			 ajaxs({
				url: '/v1/carrier/list',
				method: 'post',
				data: { offset: page, limit: 10,
				 orderCode:that.ordernumber,
				 shipAddress:that.shipAddring,
				 placeOfReceipt:that.placeOfReceipting,
				 createTimeStart:that.timers,
				 createTimeEnd:that.timered,
				 isDetach:that.staterd,
				 },
				success(res) {
					uni.hideLoading();
					if(res.data.status=="OK"){
						that.xinxi=false
						that.list = res.data.list;
						that.leng=that.list.length
						}
					res.data.list.forEach(function(v, i) {
						that.add = that.add.concat(JSON.parse(v.goodsjson));
					});
					uni.stopPullDownRefresh();
					uni.hideNavigationBarLoading();
					page++;
					//请求成功的处理
				},
				fail() {
					uni.hideNavigationBarLoading();
					uni.showToast({
					    title: '数据加载出错,请检查网络',
						icon:"none"
					})
				}
			});
			},1000)
		},
		orderdetail(i) {
			uni.navigateTo({
				url: '../orderdetailed/orderdetailed?id=' + this.list[i].id
			});
		}
	}
};
</script>

<style>
.plac {
	background: linear-gradient(90deg, rgba(53, 132, 196, 1) 0%, rgba(4, 42, 88, 1) 100%);
	height: 8px;
	border-radius: 7px;
}
.plan {
	color: #000000;
}
.plans {
	color: #9b9b9b;
}
.loading {
	line-height: 2em;
	text-align: center;
	color: #888;
	margin-top: 30px;
}
.contont {
	width: 355px;
	height: 168px;
	background: rgba(255, 255, 255, 1);
	border-radius: 8px;
}
.conton {
	width: 355px;
	height: 226px;
	background: rgba(255, 255, 255, 1);
	border-radius: 8px;
	margin-top: 10px;
}
.ordercode {
	height: 45px;
	display: flex;
	border-bottom: 1px solid #f5f5f5;
	justify-content: space-between;
	align-items: center;
	box-sizing: border-box;
}
.address {
	height: 52px;
	display: flex;
	flex-direction: column;
	font-size: 12px;
	font-weight: 400;
}
.addresscar {
	margin-top: 6px;
	display: flex;
	align-items: center;
}
.number {
	display: flex;
}
.inputed{
	width:293px;
	height:40px;
	background:rgba(255,255,255,1);
	box-sizing: border-box;
}
.numbers {
	background: rgba(242, 243, 246, 1);
	border-radius: 4px;
	display: flex;
	justify-content: space-around;
	align-items: center;
	font-size: 12px;
	margin-left: 5px;
}
.money {
	margin-top: 10px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.contonts {
	width: 355px;
	height: 500px;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.searbut{
	width:62px;
	height:40px;
	background:#FFFFFF;
	border: none;
	color: #032A5A;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.addred{
	width:88px;
	height:45px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #4A4A4A;
	font-size: 15px;
	background-color: #FFFFFF;
}
	picker-view{
		width:375px;
		height:276px;
		background:rgba(255,255,255,1);
		border-top:1px solid #F5F5F5 ;
	}
	.mask{
		width: 100%;
		height:100%;
		position:fixed;
		flex-direction: column;
		background: rgba(0,0,0,0.4);
			display: flex;
				z-index: 2;
				justify-content: flex-end;
		top: 0;
		left: 0;
	}
	.masked{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.addresing{
		width:68px;
		height:32px;
		background:rgba(245,245,245,1);
		border-radius:6px;
		font-size: 12px;
		color: #888888;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 15px;
		margin-right: 15px;
	}
</style>
